<html xmlns:th="http://www.thymeleaf.org"  
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4"    
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">    
<html>
<head th:include="common/common::header">
    <meta charset="UTF-8">
    <style type="text/css">
      #index {
            justify-content: space-between;
            flex-wrap: wrap;
            opacity: 0;
        }
        .index-l {
            width: 100%;
            margin-top: 0.5%;
            margin-left: 29px;
        }
    </style>
</head>

<body>
		<div class="index-l" id="SqlToolbar">
	      <div>
	    	  <shiro:hasPermission name="sys:datasql:back">
	      	  <a href="javascript:void(0)"  data-options="iconCls:'fa fa-pencil'" id="dataEdit" class="easyui-linkbutton primary" style="height: 32px;border-left-width: 1px;">备份</a>
       			</shiro:hasPermission>
       		  <a href="javascript:void(0)"   id="rebreak_sql" class="easyui-linkbutton success" data-options="iconCls:'fa fa-refresh'">刷新</a>
	      </div>
	      </div>
	      <div style="opacity: 1;width:100%;min-height:780px;margin-top: 0.5%">
	        <table id="sqlTable" style="opacity: 1;width:100%;height:780px;margin-top: 2%" class="easyui-datagrid" th:attr="data-options=${dataGrid }">
			</table>
	</div>
<script type="text/javascript">
$("#rebreak_sql").click(function() {
		AM.gridSearch({
		gridId:'sqlTable',
		data:[]		     
	});
})
$("#dataEdit").click(function() {
	var data = $("#sqlTable").datagrid('getSelected');
	if(data == null) {
		layer.msg("请选择一行数据",{icon:7,time:3000});
		return;
	}
	
	 $.messager.confirm('确认', '您确认想要备份'+data.tableName+'吗？', function (r) {
            if (r) {
            	$.ajax({
        			url:'/system/sql/backup',
        			type: 'POST',
        			dataType:'json',
        			success: function(data){
        					if (data.status ==200) {
        						$.messager.alert('消息','备份成功');
        					}
        				},
        				error:function(data) {
        					
        					console.log(data.data);	
        				}
        			})
            }
        });
})
	</script>
</body>

</html>